/* #include "../include/threadPool.h" */
#include "../include/clientEntrance.h"
#include <openssl/md5.h>
/* #include "../include/haxi.h" */
int haxi( const char *file,char *buf){
    MD5_CTX ctx;
    MD5_Init(&ctx);
    int fd=open(file,O_RDWR);   //打开文件流 用来将内容转化成哈希值
    char tempbuf[4096]={0};     
    while(1){
        bzero(tempbuf,sizeof(tempbuf));
        ssize_t sret=read(fd,tempbuf,sizeof(tempbuf));
        if(sret==0){
            break;
        }
        MD5_Update(&ctx,tempbuf,sret);
    }   
    unsigned char md[16];  //存放二进制数据
    MD5_Final(md,&ctx);
    char md5str[33]={0};
    for(int i=0;i<16;i++){
        char temp[3]={0};
        sprintf(temp,"%02x",md[i]);
        strcat(md5str,temp);
    }
    strcpy(buf,md5str);
    /* printf("%s\n",md5str); */
    return 0;
}
/* int main(){ */
/*     char buf[10000000]={0}; */
/*     haxi( "/home/luozheng/zhangsan/2.jpg",buf); */
/*     return 0; */
/* } */
